<?php

namespace backend\controllers;

use common\helpers\predis\Predis;
use Yii;
use zacksleo\yii2\backend\controllers\SiteController as BaseController;
use common\models\Coupon;
use common\models\UserCoupon;

/**
 * Site controller
 */
class SiteController extends BaseController
{
    public function actionIndex()
    {
//        echo phpinfo();exit;
        $totalNum=Coupon::find()->count();
        $useNum=UserCoupon::getCollection()->count();
//        $useNumCacheKey = "overt-coupon-user-num";
//        $totalNUmCacheKey = "overt-coupon-total-num";
//        $totalNum = Predis::getInstance()->getClient()->client->get($totalNUmCacheKey);
//        $useNum = Predis::getInstance()->getClient()->client->get($useNumCacheKey);
        return $this->render('index', ['totalNum' => intval($totalNum), 'useNum' => intval($useNum)]);
    }


}
